package com.etc.my.service.impl;


import com.etc.my.dao.PushDao;
import com.etc.my.dto.CountDto;
import com.etc.my.dto.PushDto;
import com.etc.my.entity.Push;
import com.etc.my.service.PushService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PushServiceImpl implements PushService {
    @Autowired
    private PushDao dao;

    public PushDao getDao() {
        return dao;
    }

    public void setDao(PushDao dao) {
        this.dao = dao;
    }

    @Override
    public List<Push> getPushListByUserIdOfPage(Integer userId ,Integer page,Integer size) {
        if(userId!=null){
            return dao.queryPushListByUserIdOfPage(userId,page,size);
        }
        return null;
    }

    @Override
    public CountDto getCountPushByUserId(Integer userId) {
        if(userId!=null){
            return dao.queryCountPushByUserId(userId);
        }
        return null;
    }

    @Override
    public boolean addWantCar(PushDto pushDto) {
        if (pushDto.getPush_brand()!=null&&pushDto.getPush_price()!=null&&pushDto.getPush_dept()!=null){
            return dao.addWantCar(pushDto);
        }
        return false;
    }

    @Override
    public boolean deletePush(Integer id) {
        return dao.deletePush(id);
    }
}
